package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.CollectedStoreEntity;
import com.zw.yzk.kabu.model.CollectedStoreModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/3/15.
 */

public class CollectedStoreMapper {

    @Inject
    public CollectedStoreMapper() {
    }

    public CollectedStoreModel transfer(CollectedStoreEntity.Store store) {
        CollectedStoreModel model = new CollectedStoreModel();
        model.setImage(store.shopImage);
        model.setName(store.shpName);
        model.setRemark(store.shopSign);
        model.setStoreId(store.shopOwnerId);

        return model;
    }

    public List<CollectedStoreModel> transfer(CollectedStoreEntity entity) {
        List<CollectedStoreModel> modelList = new ArrayList<>();
        if (entity.result.shopList == null || entity.result.shopList.isEmpty()) {
            return modelList;
        }
        for (CollectedStoreEntity.Store store : entity.result.shopList) {
            modelList.add(transfer(store));
        }
        return modelList;
    }
}
